package com.orange.score.activity.entry;

import android.content.Context;
import android.graphics.Color;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseExpandableListAdapter;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.orange.score.model.index.CompanyManager;
import com.orange.score.model.index.DaxiaoOdds;
import com.orange.score.model.index.Odds;
import com.orange.score.model.index.OddsGroup;
import com.orange.score.model.index.OupeiOdds;
import com.orange.score.model.index.YapeiOdds;
import com.orange.score.model.match.Match;
import com.orange.score.utils.DataUtils;
import java.util.List;

public class RealtimeIndexOddsListAdapter extends BaseExpandableListAdapter
{
  private CompanyManager companyManager;
  private Context context;
  private List<OddsGroup> groups;

  public RealtimeIndexOddsListAdapter(Context paramContext, List<OddsGroup> paramList, CompanyManager paramCompanyManager)
  {
    this.context = paramContext;
    this.groups = paramList;
    this.companyManager = paramCompanyManager;
  }

  public Object getChild(int paramInt1, int paramInt2)
  {
    return ((OddsGroup)this.groups.get(paramInt1)).children.get(paramInt2);
  }

  public long getChildId(int paramInt1, int paramInt2)
  {
    return paramInt2;
  }

  public View getChildView(int paramInt1, int paramInt2, boolean paramBoolean, View paramView, ViewGroup paramViewGroup)
  {
    Holder localHolder;
    Odds localOdds;
    View localView;
    if (paramView != null)
      localHolder = (Holder)paramView.getTag();
    while (true)
    {
      localOdds = (Odds)((OddsGroup)this.groups.get(paramInt1)).children.get(paramInt2);
      if (localOdds != null)
        break;
      localView = null;
      return localView;
      localHolder = new Holder(this);
      paramView = LayoutInflater.from(this.context).inflate(2130903085, null);
      localHolder.homeTeamChupan = ((TextView)paramView.findViewById(2131558526));
      localHolder.awayTeamChupan = ((TextView)paramView.findViewById(2131558528));
      localHolder.chupan = ((TextView)paramView.findViewById(2131558527));
      localHolder.homeTeamOdds = ((TextView)paramView.findViewById(2131558529));
      localHolder.awayTeamOdds = ((TextView)paramView.findViewById(2131558531));
      localHolder.instantOdds = ((TextView)paramView.findViewById(2131558530));
      localHolder.companyName = ((TextView)paramView.findViewById(2131558525));
      paramView.setTag(localHolder);
    }
    localHolder.companyName.setText(this.companyManager.getCompanyNameById(localOdds.getCompanyId()));
    switch ($SWITCH_TABLE$com$orange$score$model$index$OddsType()[this.companyManager.getOddsType().ordinal()])
    {
    default:
    case 1:
    case 3:
    case 2:
    }
    while (true)
    {
      while (true)
      {
        label501: DaxiaoOdds localDaxiaoOdds;
        do
        {
          do
            while (true)
            {
              while (true)
              {
                label537: label573: OupeiOdds localOupeiOdds;
                do
                {
                  do
                    while (true)
                    {
                      while (true)
                      {
                        YapeiOdds localYapeiOdds;
                        do
                        {
                          do
                            while (true)
                              localView = paramView;
                          while (!(localOdds instanceof YapeiOdds));
                          localYapeiOdds = (YapeiOdds)localOdds;
                          localHolder.homeTeamChupan.setText(localYapeiOdds.getHomeTeamChupan());
                          localHolder.awayTeamChupan.setText(localYapeiOdds.getAwayTemaChupan());
                          localHolder.chupan.setText(DataUtils.toChuPanString(localYapeiOdds.getChupan()));
                          localHolder.homeTeamOdds.setText(localYapeiOdds.getHomeTeamOdds());
                          localHolder.awayTeamOdds.setText(localYapeiOdds.getAwayTemaOdds());
                          localHolder.instantOdds.setText(DataUtils.toChuPanString(localYapeiOdds.getInstantOdds()));
                          if (!(localOdds.isOddsJustUpdate()))
                            break label573;
                          if (localYapeiOdds.homeTeamOddsFlag == 1)
                          {
                            localHolder.homeTeamOdds.setBackgroundColor(Color.argb(255, 254, 228, 203));
                            if (localYapeiOdds.awayTeamOddsFlag != 1)
                              break label501;
                            localHolder.awayTeamOdds.setBackgroundColor(Color.argb(255, 254, 228, 203));
                          }
                          while (true)
                          {
                            do
                              while (true)
                              {
                                do
                                  while (true)
                                  {
                                    if (localYapeiOdds.pankouFlag != 1)
                                      break label537;
                                    localHolder.instantOdds.setBackgroundColor(Color.argb(255, 254, 228, 203));
                                  }
                                while (localYapeiOdds.homeTeamOddsFlag != -1);
                                localHolder.homeTeamOdds.setBackgroundColor(Color.argb(255, 234, 253, 174));
                              }
                            while (localYapeiOdds.awayTeamOddsFlag != -1);
                            localHolder.awayTeamOdds.setBackgroundColor(Color.argb(255, 234, 253, 174));
                          }
                        }
                        while (localYapeiOdds.pankouFlag != -1);
                        localHolder.instantOdds.setBackgroundColor(Color.argb(255, 234, 253, 174));
                      }
                      localHolder.homeTeamOdds.setBackgroundResource(2130837713);
                      localHolder.awayTeamOdds.setBackgroundResource(2130837713);
                      localHolder.instantOdds.setBackgroundResource(2130837713);
                    }
                  while (!(localOdds instanceof OupeiOdds));
                  localOupeiOdds = (OupeiOdds)localOdds;
                  localHolder.homeTeamChupan.setText(localOupeiOdds.getHomeWinChupei());
                  localHolder.awayTeamChupan.setText(localOupeiOdds.getAwayWinChupei());
                  localHolder.chupan.setText(localOupeiOdds.getDrawWinChupei());
                  localHolder.homeTeamOdds.setText(localOupeiOdds.getHomeWinInstantOdds());
                  localHolder.awayTeamOdds.setText(localOupeiOdds.getAwayWinInstantOdds());
                  localHolder.instantOdds.setText(localOupeiOdds.getDrawInstantOdds());
                  if (!(localOdds.isOddsJustUpdate()))
                    break label914;
                  if (localOupeiOdds.homeTeamOddsFlag == 1)
                  {
                    localHolder.homeTeamOdds.setBackgroundColor(Color.argb(255, 254, 228, 203));
                    if (localOupeiOdds.awayTeamOddsFlag != 1)
                      break label842;
                    localHolder.awayTeamOdds.setBackgroundColor(Color.argb(255, 254, 228, 203));
                  }
                  while (true)
                  {
                    label842: 
                    do
                      while (true)
                      {
                        do
                          while (true)
                          {
                            if (localOupeiOdds.pankouFlag != 1)
                              break label878;
                            localHolder.instantOdds.setBackgroundColor(Color.argb(255, 254, 228, 203));
                          }
                        while (localOupeiOdds.homeTeamOddsFlag != -1);
                        localHolder.homeTeamOdds.setBackgroundColor(Color.argb(255, 234, 253, 174));
                      }
                    while (localOupeiOdds.awayTeamOddsFlag != -1);
                    label878: localHolder.awayTeamOdds.setBackgroundColor(Color.argb(255, 234, 253, 174));
                  }
                }
                while (localOupeiOdds.pankouFlag != -1);
                localHolder.instantOdds.setBackgroundColor(Color.argb(255, 234, 253, 174));
              }
              label914: localHolder.homeTeamOdds.setBackgroundResource(2130837713);
              localHolder.awayTeamOdds.setBackgroundResource(2130837713);
              localHolder.instantOdds.setBackgroundResource(2130837713);
            }
          while (!(localOdds instanceof DaxiaoOdds));
          localDaxiaoOdds = (DaxiaoOdds)localOdds;
          localHolder.homeTeamChupan.setText(localDaxiaoOdds.getBigChupan());
          localHolder.awayTeamChupan.setText(localDaxiaoOdds.getSmallChupan());
          localHolder.chupan.setText(DataUtils.toDaxiaoPanKouString(localDaxiaoOdds.getChupan()));
          localHolder.homeTeamOdds.setText(localDaxiaoOdds.getBigOdds());
          localHolder.awayTeamOdds.setText(localDaxiaoOdds.getSmallChupan());
          localHolder.instantOdds.setText(DataUtils.toDaxiaoPanKouString(localDaxiaoOdds.getInstantOdds()));
          if (!(localOdds.isOddsJustUpdate()))
            break label1261;
          if (localDaxiaoOdds.homeTeamOddsFlag == 1)
          {
            localHolder.homeTeamOdds.setBackgroundColor(Color.argb(255, 254, 228, 203));
            if (localDaxiaoOdds.awayTeamOddsFlag != 1)
              break label1189;
            localHolder.awayTeamOdds.setBackgroundColor(Color.argb(255, 254, 228, 203));
          }
          while (true)
          {
            label1189: 
            do
              while (true)
              {
                do
                  while (true)
                  {
                    if (localDaxiaoOdds.pankouFlag != 1)
                      break label1225;
                    localHolder.instantOdds.setBackgroundColor(Color.argb(255, 254, 228, 203));
                  }
                while (localDaxiaoOdds.homeTeamOddsFlag != -1);
                localHolder.homeTeamOdds.setBackgroundColor(Color.argb(255, 234, 253, 174));
              }
            while (localDaxiaoOdds.awayTeamOddsFlag != -1);
            label1225: localHolder.awayTeamOdds.setBackgroundColor(Color.argb(255, 234, 253, 174));
          }
        }
        while (localDaxiaoOdds.pankouFlag != -1);
        localHolder.instantOdds.setBackgroundColor(Color.argb(255, 234, 253, 174));
      }
      label1261: localHolder.homeTeamOdds.setBackgroundResource(2130837713);
      localHolder.awayTeamOdds.setBackgroundResource(2130837713);
      localHolder.instantOdds.setBackgroundResource(2130837713);
    }
  }

  public int getChildrenCount(int paramInt)
  {
    return ((OddsGroup)this.groups.get(paramInt)).children.size();
  }

  public Object getGroup(int paramInt)
  {
    return this.groups.get(paramInt);
  }

  public int getGroupCount()
  {
    return this.groups.size();
  }

  public long getGroupId(int paramInt)
  {
    return paramInt;
  }

  public View getGroupView(int paramInt, boolean paramBoolean, View paramView, ViewGroup paramViewGroup)
  {
    TitleHolder localTitleHolder;
    if (paramView != null)
    {
      localTitleHolder = (TitleHolder)paramView.getTag();
      if (!(paramBoolean))
        break label438;
      localTitleHolder.groupImage.setBackgroundResource(2130837697);
      localTitleHolder.titleLayout.setVisibility(0);
      Match localMatch = ((OddsGroup)this.groups.get(paramInt)).match;
      if (localMatch != null)
      {
        localTitleHolder.homeTeamName.setText(localMatch.getHomeTeamName());
        localTitleHolder.awayTeamName.setText(localMatch.getAwayTeamName());
        localTitleHolder.matchTime.setText(localMatch.getMatchTime().substring(4, 6) + "/" + localMatch.getMatchTime().substring(6, 8));
        localTitleHolder.leagueName.setText(localMatch.getLeagueName());
        String str = "VS";
        if (localMatch.getStatus() == -1)
          str = localMatch.getHomeTeamScore() + ":" + localMatch.getAwayTeamScore();
        localTitleHolder.finishScore.setText(str);
      }
      switch ($SWITCH_TABLE$com$orange$score$model$index$OddsType()[this.companyManager.getOddsType().ordinal()])
      {
      default:
      case 1:
      case 3:
      case 2:
      }
    }
    while (true)
    {
      while (true)
      {
        while (true)
        {
          while (true)
          {
            while (true)
            {
              return paramView;
              localTitleHolder = new TitleHolder(this);
              paramView = LayoutInflater.from(this.context).inflate(2130903086, null);
              localTitleHolder.groupImage = ((ImageView)paramView.findViewById(2131558532));
              localTitleHolder.leagueName = ((TextView)paramView.findViewById(2131558533));
              localTitleHolder.homeTeamName = ((TextView)paramView.findViewById(2131558535));
              localTitleHolder.awayTeamName = ((TextView)paramView.findViewById(2131558537));
              localTitleHolder.matchTime = ((TextView)paramView.findViewById(2131558534));
              localTitleHolder.finishScore = ((TextView)paramView.findViewById(2131558536));
              localTitleHolder.titleLayout = ((LinearLayout)paramView.findViewById(2131558521));
              localTitleHolder.homeColumn = ((TextView)paramView.findViewById(2131558522));
              localTitleHolder.middleColumn = ((TextView)paramView.findViewById(2131558523));
              localTitleHolder.awayColumn = ((TextView)paramView.findViewById(2131558524));
              paramView.setTag(localTitleHolder);
            }
            label438: localTitleHolder.groupImage.setBackgroundResource(2130837695);
            localTitleHolder.titleLayout.setVisibility(8);
          }
          localTitleHolder.homeColumn.setText("上盘");
          localTitleHolder.middleColumn.setText("盘口");
          localTitleHolder.awayColumn.setText("下盘");
        }
        localTitleHolder.homeColumn.setText("主胜");
        localTitleHolder.middleColumn.setText("和");
        localTitleHolder.awayColumn.setText("客胜");
      }
      localTitleHolder.homeColumn.setText("大球");
      localTitleHolder.middleColumn.setText("盘口");
      localTitleHolder.awayColumn.setText("小球");
    }
  }

  public boolean hasStableIds()
  {
    return false;
  }

  public boolean isChildSelectable(int paramInt1, int paramInt2)
  {
    return false;
  }

  class Holder
  {
    TextView awayTeamChupan;
    TextView awayTeamOdds;
    TextView chupan;
    TextView companyName;
    TextView homeTeamChupan;
    TextView homeTeamOdds;
    TextView instantOdds;
  }

  class TitleHolder
  {
    TextView awayColumn;
    TextView awayTeamName;
    TextView finishScore;
    ImageView groupImage;
    TextView homeColumn;
    TextView homeTeamName;
    TextView leagueName;
    TextView matchTime;
    TextView middleColumn;
    LinearLayout titleLayout;
  }
}